﻿using DXApplicationTangche.UC.面料审核.Service;
using DXApplicationTangche.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.面料库存.入库
{
    public partial class Form坚山面料库存 : DevExpress.XtraEditors.XtraForm
    {
        private List<String> kashiyamaFabric = new List<string>();
        private DataTable dt = new DataTable();

        public Form坚山面料库存()
        {
            InitializeComponent();
            #region
            this.kashiyamaFabric.Add("11117_325");
            this.kashiyamaFabric.Add("11120 C83");
            this.kashiyamaFabric.Add("11120_C83");
            this.kashiyamaFabric.Add("11124_892");
            this.kashiyamaFabric.Add("11138_816");
            this.kashiyamaFabric.Add("11154_537");
            this.kashiyamaFabric.Add("11158_373");
            this.kashiyamaFabric.Add("1405472-1");
            this.kashiyamaFabric.Add("1405826-5");
            this.kashiyamaFabric.Add("1411115-1");
            this.kashiyamaFabric.Add("1411115-2");
            this.kashiyamaFabric.Add("1411627-1");
            this.kashiyamaFabric.Add("1414423-5");
            this.kashiyamaFabric.Add("1415541-1");
            this.kashiyamaFabric.Add("1415541-4");
            this.kashiyamaFabric.Add("1415578-3-D");
            this.kashiyamaFabric.Add("1436697-1");
            this.kashiyamaFabric.Add("1436697-2");
            this.kashiyamaFabric.Add("21143 H09");
            this.kashiyamaFabric.Add("21143_H09");
            this.kashiyamaFabric.Add("21156_495");
            this.kashiyamaFabric.Add("21156_625");
            this.kashiyamaFabric.Add("21170_315");
            this.kashiyamaFabric.Add("21170_323");
            this.kashiyamaFabric.Add("21170_375");
            this.kashiyamaFabric.Add("21170_455");
            this.kashiyamaFabric.Add("21170_484");
            this.kashiyamaFabric.Add("41119_892");
            this.kashiyamaFabric.Add("41121_326");
            this.kashiyamaFabric.Add("41142_113");
            this.kashiyamaFabric.Add("41171_325");
            this.kashiyamaFabric.Add("41171_U01");
            this.kashiyamaFabric.Add("41173_605");
            this.kashiyamaFabric.Add("41173_625");
            this.kashiyamaFabric.Add("41173_U53");
            this.kashiyamaFabric.Add("CAN-001");
            this.kashiyamaFabric.Add("CAN-002");
            this.kashiyamaFabric.Add("CAN-003");
            this.kashiyamaFabric.Add("CAN-004");
            this.kashiyamaFabric.Add("CAN-005");
            this.kashiyamaFabric.Add("CAN-006");
            this.kashiyamaFabric.Add("CAN-007");
            this.kashiyamaFabric.Add("CAN-008");
            this.kashiyamaFabric.Add("CAN-009");
            this.kashiyamaFabric.Add("JM-04");
            this.kashiyamaFabric.Add("JM-06");
            this.kashiyamaFabric.Add("JM-09-1");
            this.kashiyamaFabric.Add("JM-09-2");
            this.kashiyamaFabric.Add("JM-10-1");
            this.kashiyamaFabric.Add("JM-10-2");
            this.kashiyamaFabric.Add("JM-10-3");
            this.kashiyamaFabric.Add("JM-10-4");
            this.kashiyamaFabric.Add("JM-10-5");
            this.kashiyamaFabric.Add("JM-12-1");
            this.kashiyamaFabric.Add("JM-12-2");
            this.kashiyamaFabric.Add("JM-12-3");
            this.kashiyamaFabric.Add("JM-15-2");
            this.kashiyamaFabric.Add("JM-19-4");
            this.kashiyamaFabric.Add("JM-19-5");
            this.kashiyamaFabric.Add("JM-21");
            this.kashiyamaFabric.Add("JM-26");
            this.kashiyamaFabric.Add("JM-26-1");
            this.kashiyamaFabric.Add("JM-27");
            this.kashiyamaFabric.Add("JM-27-1");
            this.kashiyamaFabric.Add("JM-28-1");
            this.kashiyamaFabric.Add("JM-28-2");
            this.kashiyamaFabric.Add("JM-29-1");
            this.kashiyamaFabric.Add("JM-29-2");
            this.kashiyamaFabric.Add("JM-29-3");
            this.kashiyamaFabric.Add("JM-30-1");
            this.kashiyamaFabric.Add("JM-30-2");
            this.kashiyamaFabric.Add("JM-32-1");
            this.kashiyamaFabric.Add("JM-32-2");
            this.kashiyamaFabric.Add("JM-33-1");
            this.kashiyamaFabric.Add("JM-33-2");
            this.kashiyamaFabric.Add("JM-33-3");
            this.kashiyamaFabric.Add("JM-33-4");
            this.kashiyamaFabric.Add("JM-35-1");
            this.kashiyamaFabric.Add("JM-35-2");
            this.kashiyamaFabric.Add("JM-40");
            this.kashiyamaFabric.Add("JM-41");
            this.kashiyamaFabric.Add("JM-42");
            this.kashiyamaFabric.Add("JM42BK");
            this.kashiyamaFabric.Add("JM-44");
            this.kashiyamaFabric.Add("JM-45");
            this.kashiyamaFabric.Add("JM-46");
            this.kashiyamaFabric.Add("JM-47");
            this.kashiyamaFabric.Add("JMC24-1");
            this.kashiyamaFabric.Add("JMOX1");
            this.kashiyamaFabric.Add("JMOX2");
            this.kashiyamaFabric.Add("JMOX3");
            this.kashiyamaFabric.Add("JMOX5");
            this.kashiyamaFabric.Add("JMOX6");
            this.kashiyamaFabric.Add("SS090");
            this.kashiyamaFabric.Add("SS105");
            this.kashiyamaFabric.Add("SS107");
            this.kashiyamaFabric.Add("SS108");
            this.kashiyamaFabric.Add("SS138");
            #endregion
            this.库存刷新();
        }
        public Form坚山面料库存(DataTable dt)
        {
            InitializeComponent();
            #region
            this.kashiyamaFabric.Add("11117_325");
            this.kashiyamaFabric.Add("11120 C83");
            this.kashiyamaFabric.Add("11120_C83");
            this.kashiyamaFabric.Add("11124_892");
            this.kashiyamaFabric.Add("11138_816");
            this.kashiyamaFabric.Add("11154_537");
            this.kashiyamaFabric.Add("11158_373");
            this.kashiyamaFabric.Add("1405472-1");
            this.kashiyamaFabric.Add("1405826-5");
            this.kashiyamaFabric.Add("1411115-1");
            this.kashiyamaFabric.Add("1411115-2");
            this.kashiyamaFabric.Add("1411627-1");
            this.kashiyamaFabric.Add("1414423-5");
            this.kashiyamaFabric.Add("1415541-1");
            this.kashiyamaFabric.Add("1415541-4");
            this.kashiyamaFabric.Add("1415578-3-D");
            this.kashiyamaFabric.Add("1436697-1");
            this.kashiyamaFabric.Add("1436697-2");
            this.kashiyamaFabric.Add("21143 H09");
            this.kashiyamaFabric.Add("21143_H09");
            this.kashiyamaFabric.Add("21156_495");
            this.kashiyamaFabric.Add("21156_625");
            this.kashiyamaFabric.Add("21170_315");
            this.kashiyamaFabric.Add("21170_323");
            this.kashiyamaFabric.Add("21170_375");
            this.kashiyamaFabric.Add("21170_455");
            this.kashiyamaFabric.Add("21170_484");
            this.kashiyamaFabric.Add("41119_892");
            this.kashiyamaFabric.Add("41121_326");
            this.kashiyamaFabric.Add("41142_113");
            this.kashiyamaFabric.Add("41171_325");
            this.kashiyamaFabric.Add("41171_U01");
            this.kashiyamaFabric.Add("41173_605");
            this.kashiyamaFabric.Add("41173_625");
            this.kashiyamaFabric.Add("41173_U53");
            this.kashiyamaFabric.Add("CAN-001");
            this.kashiyamaFabric.Add("CAN-002");
            this.kashiyamaFabric.Add("CAN-003");
            this.kashiyamaFabric.Add("CAN-004");
            this.kashiyamaFabric.Add("CAN-005");
            this.kashiyamaFabric.Add("CAN-006");
            this.kashiyamaFabric.Add("CAN-007");
            this.kashiyamaFabric.Add("CAN-008");
            this.kashiyamaFabric.Add("CAN-009");
            this.kashiyamaFabric.Add("JM-04");
            this.kashiyamaFabric.Add("JM-06");
            this.kashiyamaFabric.Add("JM-09-1");
            this.kashiyamaFabric.Add("JM-09-2");
            this.kashiyamaFabric.Add("JM-10-1");
            this.kashiyamaFabric.Add("JM-10-2");
            this.kashiyamaFabric.Add("JM-10-3");
            this.kashiyamaFabric.Add("JM-10-4");
            this.kashiyamaFabric.Add("JM-10-5");
            this.kashiyamaFabric.Add("JM-12-1");
            this.kashiyamaFabric.Add("JM-12-2");
            this.kashiyamaFabric.Add("JM-12-3");
            this.kashiyamaFabric.Add("JM-15-2");
            this.kashiyamaFabric.Add("JM-19-4");
            this.kashiyamaFabric.Add("JM-19-5");
            this.kashiyamaFabric.Add("JM-21");
            this.kashiyamaFabric.Add("JM-26");
            this.kashiyamaFabric.Add("JM-26-1");
            this.kashiyamaFabric.Add("JM-27");
            this.kashiyamaFabric.Add("JM-27-1");
            this.kashiyamaFabric.Add("JM-28-1");
            this.kashiyamaFabric.Add("JM-28-2");
            this.kashiyamaFabric.Add("JM-29-1");
            this.kashiyamaFabric.Add("JM-29-2");
            this.kashiyamaFabric.Add("JM-29-3");
            this.kashiyamaFabric.Add("JM-30-1");
            this.kashiyamaFabric.Add("JM-30-2");
            this.kashiyamaFabric.Add("JM-32-1");
            this.kashiyamaFabric.Add("JM-32-2");
            this.kashiyamaFabric.Add("JM-33-1");
            this.kashiyamaFabric.Add("JM-33-2");
            this.kashiyamaFabric.Add("JM-33-3");
            this.kashiyamaFabric.Add("JM-33-4");
            this.kashiyamaFabric.Add("JM-35-1");
            this.kashiyamaFabric.Add("JM-35-2");
            this.kashiyamaFabric.Add("JM-40");
            this.kashiyamaFabric.Add("JM-41");
            this.kashiyamaFabric.Add("JM-42");
            this.kashiyamaFabric.Add("JM42BK");
            this.kashiyamaFabric.Add("JM-44");
            this.kashiyamaFabric.Add("JM-45");
            this.kashiyamaFabric.Add("JM-46");
            this.kashiyamaFabric.Add("JM-47");
            this.kashiyamaFabric.Add("JMC24-1");
            this.kashiyamaFabric.Add("JMOX1");
            this.kashiyamaFabric.Add("JMOX2");
            this.kashiyamaFabric.Add("JMOX3");
            this.kashiyamaFabric.Add("JMOX5");
            this.kashiyamaFabric.Add("JMOX6");
            this.kashiyamaFabric.Add("SS090");
            this.kashiyamaFabric.Add("SS105");
            this.kashiyamaFabric.Add("SS107");
            this.kashiyamaFabric.Add("SS108");
            this.kashiyamaFabric.Add("SS138");
            #endregion
            this.库存刷新();
            //保存xml订单
            this.dt = dt;

        }

        private void simpleButton刷新_Click(object sender, EventArgs e)
        {
            this.库存刷新();
        }
        private void 库存刷新()
        {
            List<KingDeeStockInventoryDTO> kingDeeStockInventoryDTOs = 面料审核Service.getKingDeeStockInventoryByFnames(this.kashiyamaFabric);
            this.gridControl坚山面料库存.DataSource = kingDeeStockInventoryDTOs;
            this.gridView坚山面料库存.RefreshData();
        }

        private void simpleButton导出excel_Click(object sender, EventArgs e)
        {
            SaveFileDialog fileDialog = new SaveFileDialog();
            fileDialog.Title = "导出出入库明细";
            fileDialog.Filter = "Excel文件(*.xlsx)|*.xlsx";
            DialogResult dialogResult = fileDialog.ShowDialog(this);
            if (dialogResult == DialogResult.OK)
            {
                DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
                this.gridView坚山面料库存.ExportToXlsx(fileDialog.FileName);
                DevExpress.XtraEditors.XtraMessageBox.Show("文件已保存至" + fileDialog.FileName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
                ////面料库存保存至@"tag\" + "面料库存.xlsx"，xml订单保存至@"tag\" + "xml订单.xlsx"
                //this.gridControl坚山面料库存.ExportToXlsx(@"tag\"+"面料库存.xlsx");
                ////调用saveKashiyamaExcel，两文件合并、合并后删除
                //ExcelUtil.saveCombineExcel(
                //    fileDialog.FileName,
                //    this.dt
                //    );
               
                //DevExpress.XtraEditors.XtraMessageBox.Show("文件已保存至"+ fileDialog.FileName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
